//digital trunking scanner
#define radio_model_1 "PSR-500"

//bands
#define def #define
//39 class D channels
def class_D_lf	26.75
def class_D_hf	27.14

//4 class C channels
def class_C_lf	27.15
def class_C_hf	27.19

//188 class B channels
def class_B_lf	28.80
def class_B_hf	40.58

/*
if(precision)
			var/list/posturfs = circlerangeturfs(destination,precision)
			destturf = safepick(posturfs)
*/


obj/small/radio
	name = "radio"
	icon_state = "radio"
	desc = "class D; digital trunking scanner\nA frequency range of 26.75 - 27.15"
	value = 500

	var
		model = radio_model_1
		low_freq = 	26.75	//MHz
		high_freq = 27.14
		freq = 26.75

		list/saved_channels = list()

	verb
		set_frequency(t as num)
			set category = null
			set src in usr
			if(!t) return
			if(t == 0) return
			t = min(t, src.high_freq)
			t = max(t, src.low_freq)
			t = round(t, 0.01)

			src.freq = t
			usr<<"\blue frequency set to [t] MHz"

			src.suffix = "\[[src.freq]]"

		save_talk_group(t as text)
			set category = null
			set src in usr
			set desc = "saves your frequency as a talk group"
			if(!t) return

			src.saved_channels["[t]"] = src.freq
			usr<<"\blue saved frequency [src.freq] as talk-group [t]"
		presets()
			set category = null
			set src in usr
			var/what = input("select a preset") as null|anything in src.saved_channels
			if(!usr) return
			if(!what) return


			src.freq = src.saved_channels[what]
			src.suffix = "\[[src.freq]]"